#pragma once

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
//#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#define FILE_SIZE 16

#define	_NONE		1		//没有缓冲
#define	_LINE		2		//行缓冲
#define	_FULL		3		//全缓冲
#define	_READONLY	4		//只读
#define	_WRITEONLY	5		//只写
#define	_APPEND		6		//追加

typedef struct IO_FILE
{
	int flushmod;
	int openmod;
	int fileno;
	char outbuffer[FILE_SIZE];
	int cap;
	int size;
}MYFILE;


MYFILE* mfopen(const char* filename, const char* mod);
int mfwrite(const void* ptr, int num, MYFILE* stream);
int mfread(const void* ptr, int num, MYFILE* stream);
void mfflush(MYFILE* stream);
void mfclose(MYFILE* stream);
